{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "id": "1D1383F4B2D945318EAD7C64B6320493",
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88\n",
      "  return f(*args, **kwds)\n",
      "/opt/conda/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88\n",
      "  return f(*args, **kwds)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "id": "8FA566F413DC40608D2AEDD5342F95C7",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq20_years = pd.read_csv('/home/kesci/input/eq_new5208/1999-2019.csv')\n",
    "eq1_year = pd.read_csv('/home/kesci/input/eq_new5208/earthquake.csv')\n",
    "eq_sichuan = pd.read_csv('/home/kesci/input/eq_new5208/sichuan.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "id": "5ADDE49AAF824B1D8B15DA2824FE2405",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>nst</th>\n",
       "      <th>gap</th>\n",
       "      <th>dmin</th>\n",
       "      <th>rms</th>\n",
       "      <th>...</th>\n",
       "      <th>updated</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>horizontalError</th>\n",
       "      <th>depthError</th>\n",
       "      <th>magError</th>\n",
       "      <th>magNst</th>\n",
       "      <th>status</th>\n",
       "      <th>locationSource</th>\n",
       "      <th>magSource</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>114222</th>\n",
       "      <td>2010-09-08T13:00:27.680Z</td>\n",
       "      <td>30.5270</td>\n",
       "      <td>142.0360</td>\n",
       "      <td>13.90</td>\n",
       "      <td>4.6</td>\n",
       "      <td>mb</td>\n",
       "      <td>26.0</td>\n",
       "      <td>108.2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.65</td>\n",
       "      <td>...</td>\n",
       "      <td>2014-11-07T01:42:25.448Z</td>\n",
       "      <td>Izu Islands, Japan region</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17.2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>us</td>\n",
       "      <td>us</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87796</th>\n",
       "      <td>2006-12-15T10:00:54.990Z</td>\n",
       "      <td>-4.8550</td>\n",
       "      <td>144.6850</td>\n",
       "      <td>72.60</td>\n",
       "      <td>4.9</td>\n",
       "      <td>mb</td>\n",
       "      <td>27.0</td>\n",
       "      <td>115.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.73</td>\n",
       "      <td>...</td>\n",
       "      <td>2014-11-07T01:31:08.503Z</td>\n",
       "      <td>near the north coast of New Guinea, Papua New ...</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>NaN</td>\n",
       "      <td>12.1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.0</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>us</td>\n",
       "      <td>us</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51199</th>\n",
       "      <td>2016-08-03T13:21:02.990Z</td>\n",
       "      <td>-18.1477</td>\n",
       "      <td>-178.6637</td>\n",
       "      <td>611.76</td>\n",
       "      <td>4.7</td>\n",
       "      <td>mb</td>\n",
       "      <td>NaN</td>\n",
       "      <td>35.0</td>\n",
       "      <td>3.151</td>\n",
       "      <td>0.58</td>\n",
       "      <td>...</td>\n",
       "      <td>2016-10-19T04:52:19.040Z</td>\n",
       "      <td>277km N of Ndoi Island, Fiji</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>11.3</td>\n",
       "      <td>8.1</td>\n",
       "      <td>0.059</td>\n",
       "      <td>88.0</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>us</td>\n",
       "      <td>us</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99352</th>\n",
       "      <td>2005-05-03T15:58:14.920Z</td>\n",
       "      <td>1.2410</td>\n",
       "      <td>96.9740</td>\n",
       "      <td>22.80</td>\n",
       "      <td>4.7</td>\n",
       "      <td>mb</td>\n",
       "      <td>24.0</td>\n",
       "      <td>180.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.99</td>\n",
       "      <td>...</td>\n",
       "      <td>2014-11-07T01:25:48.589Z</td>\n",
       "      <td>Nias region, Indonesia</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.0</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>us</td>\n",
       "      <td>us</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8664</th>\n",
       "      <td>2010-02-27T06:56:26.190Z</td>\n",
       "      <td>-34.3500</td>\n",
       "      <td>-72.1970</td>\n",
       "      <td>34.80</td>\n",
       "      <td>5.6</td>\n",
       "      <td>mb</td>\n",
       "      <td>27.0</td>\n",
       "      <td>116.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.97</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-05-13T18:53:57.000Z</td>\n",
       "      <td>offshore Libertador O'Higgins, Chile</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>NaN</td>\n",
       "      <td>23.1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.0</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>us</td>\n",
       "      <td>us</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            time  latitude  longitude   depth  mag magType  \\\n",
       "114222  2010-09-08T13:00:27.680Z   30.5270   142.0360   13.90  4.6      mb   \n",
       "87796   2006-12-15T10:00:54.990Z   -4.8550   144.6850   72.60  4.9      mb   \n",
       "51199   2016-08-03T13:21:02.990Z  -18.1477  -178.6637  611.76  4.7      mb   \n",
       "99352   2005-05-03T15:58:14.920Z    1.2410    96.9740   22.80  4.7      mb   \n",
       "8664    2010-02-27T06:56:26.190Z  -34.3500   -72.1970   34.80  5.6      mb   \n",
       "\n",
       "         nst    gap   dmin   rms    ...                      updated  \\\n",
       "114222  26.0  108.2    NaN  0.65    ...     2014-11-07T01:42:25.448Z   \n",
       "87796   27.0  115.4    NaN  0.73    ...     2014-11-07T01:31:08.503Z   \n",
       "51199    NaN   35.0  3.151  0.58    ...     2016-10-19T04:52:19.040Z   \n",
       "99352   24.0  180.4    NaN  0.99    ...     2014-11-07T01:25:48.589Z   \n",
       "8664    27.0  116.6    NaN  0.97    ...     2015-05-13T18:53:57.000Z   \n",
       "\n",
       "                                                    place        type  \\\n",
       "114222                          Izu Islands, Japan region  earthquake   \n",
       "87796   near the north coast of New Guinea, Papua New ...  earthquake   \n",
       "51199                        277km N of Ndoi Island, Fiji  earthquake   \n",
       "99352                              Nias region, Indonesia  earthquake   \n",
       "8664                 offshore Libertador O'Higgins, Chile  earthquake   \n",
       "\n",
       "       horizontalError depthError  magError  magNst    status  locationSource  \\\n",
       "114222             NaN       17.2       NaN     2.0  reviewed              us   \n",
       "87796              NaN       12.1       NaN     8.0  reviewed              us   \n",
       "51199             11.3        8.1     0.059    88.0  reviewed              us   \n",
       "99352              NaN        NaN       NaN     8.0  reviewed              us   \n",
       "8664               NaN       23.1       NaN     8.0  reviewed              us   \n",
       "\n",
       "       magSource  \n",
       "114222        us  \n",
       "87796         us  \n",
       "51199         us  \n",
       "99352         us  \n",
       "8664          us  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "id": "0B51570F2C6C4F04857EED2E0DCE9FCD",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time                  2010-05-10T00:25:29.740Z\n",
       "latitude                                -2.881\n",
       "longitude                              101.101\n",
       "depth                                     56.7\n",
       "mag                                        4.6\n",
       "magType                                     mb\n",
       "nst                                         25\n",
       "gap                                      180.7\n",
       "dmin                                       NaN\n",
       "rms                                       0.85\n",
       "net                                         us\n",
       "id                                  usp000hcjh\n",
       "updated               2014-11-07T01:41:28.481Z\n",
       "place              southern Sumatra, Indonesia\n",
       "type                                earthquake\n",
       "horizontalError                            NaN\n",
       "depthError                                   8\n",
       "magError                                   NaN\n",
       "magNst                                       3\n",
       "status                                reviewed\n",
       "locationSource                              us\n",
       "magSource                                   us\n",
       "Name: 6666, dtype: object"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.iloc[6666]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "FF9F28E859B74AE985FC31D16D1A4523"
   },
   "source": [
    "### 1. 数据清洗\n",
    "- 选取出需要的字段\n",
    "- 数据类型转换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "id": "B949C9536AE04E9A9AFEA02702EFEE4B",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['time', 'latitude', 'longitude', 'depth', 'mag', 'magType', 'nst',\n",
       "       'gap', 'dmin', 'rms', 'net', 'id', 'updated', 'place', 'type',\n",
       "       'horizontalError', 'depthError', 'magError', 'magNst', 'status',\n",
       "       'locationSource', 'magSource'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "id": "8A5B404D622C44BB8D850D2FCFC417F7",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "cols = ['time', 'latitude', 'longitude', 'depth', 'mag', \n",
    "        'magType', 'id', 'place', 'type', 'status']\n",
    "eq20_years = eq20_years[cols]\n",
    "eq1_year = eq1_year[cols]\n",
    "eq_sichuan = eq_sichuan[cols]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "id": "384A4C5D981E499B8C4E57B64AD8E53D",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq20_years['time'] = pd.to_datetime(eq20_years['time'])\n",
    "eq1_year['time'] = pd.to_datetime(eq1_year['time'])\n",
    "eq_sichuan['time'] = pd.to_datetime(eq_sichuan['time'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "B5F6B38532B340B78B2F1088E586744A",
    "mdEditEnable": false
   },
   "source": [
    "### 2. 问题\n",
    "- 最近地震越来越频繁了吗？还是报道的比较多而已？\n",
    "- 引发地震的因素有哪些？\n",
    "- 全世界地震频发的地区有哪些？\n",
    "- 有哪些引发全世界舆情关注的大地震？\n",
    "- 为什么四川省及其周围好像从2008年开始就地震频发？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "1226A743A59D4891AEA0FFE794E39E9F"
   },
   "source": [
    "#### 2.1 最近地震越来越频繁了吗？还是报道的比较多而已？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "id": "56BC3B268F444274A8C832F1793761FF",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>id</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>49652</th>\n",
       "      <td>2016-10-09 12:48:26.530</td>\n",
       "      <td>62.4061</td>\n",
       "      <td>2.2212</td>\n",
       "      <td>10.0</td>\n",
       "      <td>4.8</td>\n",
       "      <td>mb</td>\n",
       "      <td>us20007cxs</td>\n",
       "      <td>159km WNW of Maloy, Norway</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104093</th>\n",
       "      <td>2004-11-13 09:08:27.290</td>\n",
       "      <td>-7.9790</td>\n",
       "      <td>124.8240</td>\n",
       "      <td>22.7</td>\n",
       "      <td>4.8</td>\n",
       "      <td>mb</td>\n",
       "      <td>usp000d8bs</td>\n",
       "      <td>Banda Sea</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131096</th>\n",
       "      <td>2000-03-17 14:47:34.590</td>\n",
       "      <td>-41.0760</td>\n",
       "      <td>44.2390</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp0009pu3</td>\n",
       "      <td>Crozet Islands region</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75062</th>\n",
       "      <td>2013-10-17 20:12:36.310</td>\n",
       "      <td>-23.0534</td>\n",
       "      <td>69.1441</td>\n",
       "      <td>10.0</td>\n",
       "      <td>4.8</td>\n",
       "      <td>mb</td>\n",
       "      <td>usb000kfvj</td>\n",
       "      <td>Mid-Indian Ridge</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84271</th>\n",
       "      <td>2007-06-12 00:56:02.150</td>\n",
       "      <td>44.6400</td>\n",
       "      <td>147.6300</td>\n",
       "      <td>164.8</td>\n",
       "      <td>4.6</td>\n",
       "      <td>mb</td>\n",
       "      <td>usp000fdv3</td>\n",
       "      <td>Kuril Islands</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          time  latitude  longitude  depth  mag magType  \\\n",
       "49652  2016-10-09 12:48:26.530   62.4061     2.2212   10.0  4.8      mb   \n",
       "104093 2004-11-13 09:08:27.290   -7.9790   124.8240   22.7  4.8      mb   \n",
       "131096 2000-03-17 14:47:34.590  -41.0760    44.2390   10.0  5.5     mwc   \n",
       "75062  2013-10-17 20:12:36.310  -23.0534    69.1441   10.0  4.8      mb   \n",
       "84271  2007-06-12 00:56:02.150   44.6400   147.6300  164.8  4.6      mb   \n",
       "\n",
       "                id                       place        type    status  \n",
       "49652   us20007cxs  159km WNW of Maloy, Norway  earthquake  reviewed  \n",
       "104093  usp000d8bs                   Banda Sea  earthquake  reviewed  \n",
       "131096  usp0009pu3       Crozet Islands region  earthquake  reviewed  \n",
       "75062   usb000kfvj            Mid-Indian Ridge  earthquake  reviewed  \n",
       "84271   usp000fdv3               Kuril Islands  earthquake  reviewed  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "id": "0C0F9CED2C884ADEA5BBA57502804ACD",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq20_years.index = eq20_years['time']\n",
    "eq20_years['year'] = eq20_years['time'].dt.year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "id": "06A11A2541F749A2AB2E99539362837E",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count                         134063\n",
       "unique                        134062\n",
       "top       2001-12-28 21:14:01.950000\n",
       "freq                               2\n",
       "first     1999-06-25 00:13:36.590000\n",
       "last      2019-06-24 13:55:59.891000\n",
       "Name: time, dtype: object"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years['time'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "id": "FC747166F44C46D18C585C41FD1AC956",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# 选取2000年1月1日到2019年6月24日的数据\n",
    "eq20_years = eq20_years[eq20_years['time'] > pd.to_datetime('2000-01-01 00:00:00')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "id": "32A58C3763A34B47824881A3BF5FD11F",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f565fda1588>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"https://cdn.kesci.com/rt_upload/32A58C3763A34B47824881A3BF5FD11F/ptwcli2tcw.png\">"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eq20_years['mag'].plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "id": "F43724C77E144BFD98F15749172D5E16",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_by_years = eq20_years['id'].groupby(eq20_years['year']).count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "id": "B04479E8435F437080E523D713F15D4C",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6764.105263157895"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_by_years[:-1].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "id": "093CB41ECE2649EC9D4FD103E4755489",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"63c0ea2c21334acfb7e9b03bb37f6ae5\" style=\"width:700px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_63c0ea2c21334acfb7e9b03bb37f6ae5 = echarts.init(document.getElementById('63c0ea2c21334acfb7e9b03bb37f6ae5'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_63c0ea2c21334acfb7e9b03bb37f6ae5 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd120\\u5e74\\u5168\\u74034.5\\u7ea7\\u4ee5\\u4e0a\\u5730\\u9707\\u53d1\\u751f\\u6b21\\u6570\",\n",
       "            \"subtext\": \"\\u65f6\\u95f4: 2000\\u5e741\\u67081\\u65e5-2019\\u5e746\\u670824\\u65e5\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 6293979,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"data\": [\n",
       "                5009.0,\n",
       "                4680.0,\n",
       "                4962.0,\n",
       "                5140.0,\n",
       "                6183.0,\n",
       "                7881.0,\n",
       "                7078.0,\n",
       "                7274.0,\n",
       "                6309.0,\n",
       "                6055.0,\n",
       "                7211.0,\n",
       "                9578.0,\n",
       "                7165.0,\n",
       "                7201.0,\n",
       "                8313.0,\n",
       "                7139.0,\n",
       "                7426.0,\n",
       "                6362.0,\n",
       "                7552.0,\n",
       "                3347.0\n",
       "            ],\n",
       "            \"stack\": \"stack_6293979\",\n",
       "            \"barCategoryGap\": \"40%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 18\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"yAxis\": 6764\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"seriesId\": 6293979\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 16\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                2000,\n",
       "                2001,\n",
       "                2002,\n",
       "                2003,\n",
       "                2004,\n",
       "                2005,\n",
       "                2006,\n",
       "                2007,\n",
       "                2008,\n",
       "                2009,\n",
       "                2010,\n",
       "                2011,\n",
       "                2012,\n",
       "                2013,\n",
       "                2014,\n",
       "                2015,\n",
       "                2016,\n",
       "                2017,\n",
       "                2018,\n",
       "                2019\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"value\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_63c0ea2c21334acfb7e9b03bb37f6ae5.setOption(option_63c0ea2c21334acfb7e9b03bb37f6ae5);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x7f56669bb1d0>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Bar\n",
    "\n",
    "\n",
    "bar = Bar(\"近20年全球4.5级以上地震发生次数\", \"时间: 2000年1月1日-2019年6月24日\", width=700)\n",
    "bar.add(\"\", list(eq_by_years.index), list(eq_by_years.values),\n",
    "        is_stack=True,  bar_category_gap='40%', label_text_size=18,\n",
    "       legend_text_size=18,xaxis_label_textsize=16,yaxis_label_textsize=18,\n",
    "       mark_line_raw = [{'yAxis':6764}])\n",
    "\n",
    "bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "id": "B59115B3A658479A8C084BC36DFEE7A2",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "455"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "6764-6309"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "id": "37C378993F2743FB94F94703C4499BBE",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_by_years_7 = eq20_years[eq20_years['mag']>7].groupby('year')['id'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "id": "C517224B620C42B58E683F786CDD762E",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "12.789473684210526"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_by_years_7[:-1].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "id": "1686C07117304EFF835C529D2260CFE9",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"1a27dd2d45f74b19b54ad371d6bc7b0b\" style=\"width:700px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_1a27dd2d45f74b19b54ad371d6bc7b0b = echarts.init(document.getElementById('1a27dd2d45f74b19b54ad371d6bc7b0b'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_1a27dd2d45f74b19b54ad371d6bc7b0b = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd120\\u5e74\\u5168\\u74037\\u7ea7\\u4ee5\\u4e0a\\u5730\\u9707\\u53d1\\u751f\\u6b21\\u6570\",\n",
       "            \"subtext\": \"\\u65f6\\u95f4: 2000\\u5e741\\u67081\\u65e5-2019\\u5e746\\u670824\\u65e5\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 4148800,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"data\": [\n",
       "                11.0,\n",
       "                13.0,\n",
       "                13.0,\n",
       "                12.0,\n",
       "                13.0,\n",
       "                10.0,\n",
       "                9.0,\n",
       "                17.0,\n",
       "                9.0,\n",
       "                15.0,\n",
       "                17.0,\n",
       "                15.0,\n",
       "                15.0,\n",
       "                15.0,\n",
       "                11.0,\n",
       "                14.0,\n",
       "                13.0,\n",
       "                6.0,\n",
       "                15.0,\n",
       "                6.0\n",
       "            ],\n",
       "            \"stack\": \"stack_4148800\",\n",
       "            \"barCategoryGap\": \"40%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 18\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"yAxis\": 12.8\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"seriesId\": 4148800\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 16\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                2000,\n",
       "                2001,\n",
       "                2002,\n",
       "                2003,\n",
       "                2004,\n",
       "                2005,\n",
       "                2006,\n",
       "                2007,\n",
       "                2008,\n",
       "                2009,\n",
       "                2010,\n",
       "                2011,\n",
       "                2012,\n",
       "                2013,\n",
       "                2014,\n",
       "                2015,\n",
       "                2016,\n",
       "                2017,\n",
       "                2018,\n",
       "                2019\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"value\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_1a27dd2d45f74b19b54ad371d6bc7b0b.setOption(option_1a27dd2d45f74b19b54ad371d6bc7b0b);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x7f5666784470>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Bar\n",
    "\n",
    "\n",
    "bar = Bar(\"近20年全球7级以上地震发生次数\", \"时间: 2000年1月1日-2019年6月24日\", width=700)\n",
    "bar.add(\"\", list(eq_by_years_7.index), list(eq_by_years_7.values),\n",
    "        is_stack=True,  bar_category_gap='40%', label_text_size=18,\n",
    "       legend_text_size=18,xaxis_label_textsize=16,yaxis_label_textsize=18,\n",
    "       mark_line_raw = [{'yAxis':12.8}])\n",
    "\n",
    "bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "id": "0771194F29844CC389598197101B9085",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_by_month = eq20_years['id'].resample('M').count().reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "id": "BDBB910C916548EC8BD6EB59B521200B",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_by_month['year'] = eq_by_month['time'].dt.year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "id": "12FA0D0BB8674AA89C9EE7D7055064B5",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>id</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>228</th>\n",
       "      <td>2019-01-31</td>\n",
       "      <td>654</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>229</th>\n",
       "      <td>2019-02-28</td>\n",
       "      <td>560</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>230</th>\n",
       "      <td>2019-03-31</td>\n",
       "      <td>617</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>231</th>\n",
       "      <td>2019-04-30</td>\n",
       "      <td>636</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>232</th>\n",
       "      <td>2019-05-31</td>\n",
       "      <td>521</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>233</th>\n",
       "      <td>2019-06-30</td>\n",
       "      <td>359</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          time   id  year\n",
       "228 2019-01-31  654  2019\n",
       "229 2019-02-28  560  2019\n",
       "230 2019-03-31  617  2019\n",
       "231 2019-04-30  636  2019\n",
       "232 2019-05-31  521  2019\n",
       "233 2019-06-30  359  2019"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_by_month.tail(6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "id": "492F5B8A5EEE4BC5BCE431448896ECFF",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"1697c51b7bd0412986127a115a7eb9bf\" style=\"width:800px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_1697c51b7bd0412986127a115a7eb9bf = echarts.init(document.getElementById('1697c51b7bd0412986127a115a7eb9bf'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_1697c51b7bd0412986127a115a7eb9bf = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd15\\u5e74\\u5168\\u7403\\u6bcf\\u67084.5\\u7ea7\\u4ee5\\u4e0a\\u5730\\u9707\\u6b21\\u6570\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 6729048,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2015\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\\u6708\",\n",
       "                    556\n",
       "                ],\n",
       "                [\n",
       "                    \"2\\u6708\",\n",
       "                    519\n",
       "                ],\n",
       "                [\n",
       "                    \"3\\u6708\",\n",
       "                    520\n",
       "                ],\n",
       "                [\n",
       "                    \"4\\u6708\",\n",
       "                    524\n",
       "                ],\n",
       "                [\n",
       "                    \"5\\u6708\",\n",
       "                    711\n",
       "                ],\n",
       "                [\n",
       "                    \"6\\u6708\",\n",
       "                    515\n",
       "                ],\n",
       "                [\n",
       "                    \"7\\u6708\",\n",
       "                    601\n",
       "                ],\n",
       "                [\n",
       "                    \"8\\u6708\",\n",
       "                    542\n",
       "                ],\n",
       "                [\n",
       "                    \"9\\u6708\",\n",
       "                    886\n",
       "                ],\n",
       "                [\n",
       "                    \"10\\u6708\",\n",
       "                    521\n",
       "                ],\n",
       "                [\n",
       "                    \"11\\u6708\",\n",
       "                    635\n",
       "                ],\n",
       "                [\n",
       "                    \"12\\u6708\",\n",
       "                    609\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 6729048\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2016\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\\u6708\",\n",
       "                    536\n",
       "                ],\n",
       "                [\n",
       "                    \"2\\u6708\",\n",
       "                    498\n",
       "                ],\n",
       "                [\n",
       "                    \"3\\u6708\",\n",
       "                    465\n",
       "                ],\n",
       "                [\n",
       "                    \"4\\u6708\",\n",
       "                    692\n",
       "                ],\n",
       "                [\n",
       "                    \"5\\u6708\",\n",
       "                    530\n",
       "                ],\n",
       "                [\n",
       "                    \"6\\u6708\",\n",
       "                    574\n",
       "                ],\n",
       "                [\n",
       "                    \"7\\u6708\",\n",
       "                    577\n",
       "                ],\n",
       "                [\n",
       "                    \"8\\u6708\",\n",
       "                    727\n",
       "                ],\n",
       "                [\n",
       "                    \"9\\u6708\",\n",
       "                    753\n",
       "                ],\n",
       "                [\n",
       "                    \"10\\u6708\",\n",
       "                    480\n",
       "                ],\n",
       "                [\n",
       "                    \"11\\u6708\",\n",
       "                    716\n",
       "                ],\n",
       "                [\n",
       "                    \"12\\u6708\",\n",
       "                    878\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 6729048\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2017\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\\u6708\",\n",
       "                    613\n",
       "                ],\n",
       "                [\n",
       "                    \"2\\u6708\",\n",
       "                    465\n",
       "                ],\n",
       "                [\n",
       "                    \"3\\u6708\",\n",
       "                    484\n",
       "                ],\n",
       "                [\n",
       "                    \"4\\u6708\",\n",
       "                    517\n",
       "                ],\n",
       "                [\n",
       "                    \"5\\u6708\",\n",
       "                    538\n",
       "                ],\n",
       "                [\n",
       "                    \"6\\u6708\",\n",
       "                    393\n",
       "                ],\n",
       "                [\n",
       "                    \"7\\u6708\",\n",
       "                    488\n",
       "                ],\n",
       "                [\n",
       "                    \"8\\u6708\",\n",
       "                    461\n",
       "                ],\n",
       "                [\n",
       "                    \"9\\u6708\",\n",
       "                    624\n",
       "                ],\n",
       "                [\n",
       "                    \"10\\u6708\",\n",
       "                    520\n",
       "                ],\n",
       "                [\n",
       "                    \"11\\u6708\",\n",
       "                    733\n",
       "                ],\n",
       "                [\n",
       "                    \"12\\u6708\",\n",
       "                    526\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 6729048\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2018\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\\u6708\",\n",
       "                    557\n",
       "                ],\n",
       "                [\n",
       "                    \"2\\u6708\",\n",
       "                    563\n",
       "                ],\n",
       "                [\n",
       "                    \"3\\u6708\",\n",
       "                    550\n",
       "                ],\n",
       "                [\n",
       "                    \"4\\u6708\",\n",
       "                    486\n",
       "                ],\n",
       "                [\n",
       "                    \"5\\u6708\",\n",
       "                    556\n",
       "                ],\n",
       "                [\n",
       "                    \"6\\u6708\",\n",
       "                    509\n",
       "                ],\n",
       "                [\n",
       "                    \"7\\u6708\",\n",
       "                    558\n",
       "                ],\n",
       "                [\n",
       "                    \"8\\u6708\",\n",
       "                    797\n",
       "                ],\n",
       "                [\n",
       "                    \"9\\u6708\",\n",
       "                    691\n",
       "                ],\n",
       "                [\n",
       "                    \"10\\u6708\",\n",
       "                    839\n",
       "                ],\n",
       "                [\n",
       "                    \"11\\u6708\",\n",
       "                    633\n",
       "                ],\n",
       "                [\n",
       "                    \"12\\u6708\",\n",
       "                    813\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 6729048\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"2019\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\\u6708\",\n",
       "                    654\n",
       "                ],\n",
       "                [\n",
       "                    \"2\\u6708\",\n",
       "                    560\n",
       "                ],\n",
       "                [\n",
       "                    \"3\\u6708\",\n",
       "                    617\n",
       "                ],\n",
       "                [\n",
       "                    \"4\\u6708\",\n",
       "                    636\n",
       "                ],\n",
       "                [\n",
       "                    \"5\\u6708\",\n",
       "                    521\n",
       "                ],\n",
       "                [\n",
       "                    \"6\\u6708\",\n",
       "                    359\n",
       "                ],\n",
       "                [\n",
       "                    \"7\\u6708\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"8\\u6708\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"9\\u6708\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"10\\u6708\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"11\\u6708\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"12\\u6708\",\n",
       "                    null\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 6729048\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"2015\",\n",
       "                \"2016\",\n",
       "                \"2017\",\n",
       "                \"2018\",\n",
       "                \"2019\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": 30,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 15\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 16\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"1\\u6708\",\n",
       "                \"2\\u6708\",\n",
       "                \"3\\u6708\",\n",
       "                \"4\\u6708\",\n",
       "                \"5\\u6708\",\n",
       "                \"6\\u6708\",\n",
       "                \"7\\u6708\",\n",
       "                \"8\\u6708\",\n",
       "                \"9\\u6708\",\n",
       "                \"10\\u6708\",\n",
       "                \"11\\u6708\",\n",
       "                \"12\\u6708\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"value\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_1697c51b7bd0412986127a115a7eb9bf.setOption(option_1697c51b7bd0412986127a115a7eb9bf);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.line.Line at 0x7f5665b2e160>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Line\n",
    "\n",
    "\n",
    "month_name = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']\n",
    "line = Line(\"近5年全球每月4.5级以上地震次数\", width=800, height=400)\n",
    "for y in range(2015, 2019):\n",
    "    sub_data = eq_by_month[eq_by_month['year'] == y]\n",
    "    line.add(str(y), month_name, list(sub_data['id']), is_smooth=True,\n",
    "             legend_text_size=15,xaxis_label_textsize=16, yaxis_label_textsize=18,legend_top=30)\n",
    "\n",
    "line.add('2019', month_name, [654, 560, 617, 636, 521, 359, None, None, None, None, None, None], is_smooth=True,\n",
    "             legend_text_size=15,xaxis_label_textsize=16,\n",
    "             yaxis_label_textsize=18,legend_top=30)\n",
    "line"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "DAA0A62688DA4995805EB94EEA03DBF5",
    "mdEditEnable": false
   },
   "source": [
    "#### 2.2 引发地震的因素有哪些？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "id": "DFA1F643C9854747857044D5E4A3E0F6",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>id</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>37011</th>\n",
       "      <td>2018-08-17 07:20:48.507</td>\n",
       "      <td>51.285400</td>\n",
       "      <td>-177.879600</td>\n",
       "      <td>25.60</td>\n",
       "      <td>2.00</td>\n",
       "      <td>ml</td>\n",
       "      <td>ak20107845</td>\n",
       "      <td>69km SSE of Tanaga Volcano, Alaska</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84272</th>\n",
       "      <td>2019-02-01 22:40:44.392</td>\n",
       "      <td>61.467200</td>\n",
       "      <td>-149.902500</td>\n",
       "      <td>36.00</td>\n",
       "      <td>1.20</td>\n",
       "      <td>ml</td>\n",
       "      <td>ak0191hajb4c</td>\n",
       "      <td>6km SSE of Big Lake, Alaska</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78557</th>\n",
       "      <td>2018-10-17 02:03:15.262</td>\n",
       "      <td>38.536800</td>\n",
       "      <td>-118.467600</td>\n",
       "      <td>1.50</td>\n",
       "      <td>1.10</td>\n",
       "      <td>ml</td>\n",
       "      <td>nn00661286</td>\n",
       "      <td>13km E of Hawthorne, Nevada</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24307</th>\n",
       "      <td>2018-12-03 11:02:16.221</td>\n",
       "      <td>39.335000</td>\n",
       "      <td>-120.041000</td>\n",
       "      <td>3.90</td>\n",
       "      <td>0.20</td>\n",
       "      <td>ml</td>\n",
       "      <td>nn00667978</td>\n",
       "      <td>10km NNW of Incline Village, Nevada</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12701</th>\n",
       "      <td>2019-05-08 22:07:06.990</td>\n",
       "      <td>38.821667</td>\n",
       "      <td>-122.856667</td>\n",
       "      <td>1.76</td>\n",
       "      <td>0.58</td>\n",
       "      <td>md</td>\n",
       "      <td>nc73178980</td>\n",
       "      <td>10km WNW of The Geysers, CA</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>automatic</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         time   latitude   longitude  depth   mag magType  \\\n",
       "37011 2018-08-17 07:20:48.507  51.285400 -177.879600  25.60  2.00      ml   \n",
       "84272 2019-02-01 22:40:44.392  61.467200 -149.902500  36.00  1.20      ml   \n",
       "78557 2018-10-17 02:03:15.262  38.536800 -118.467600   1.50  1.10      ml   \n",
       "24307 2018-12-03 11:02:16.221  39.335000 -120.041000   3.90  0.20      ml   \n",
       "12701 2019-05-08 22:07:06.990  38.821667 -122.856667   1.76  0.58      md   \n",
       "\n",
       "                 id                                place        type  \\\n",
       "37011    ak20107845   69km SSE of Tanaga Volcano, Alaska  earthquake   \n",
       "84272  ak0191hajb4c          6km SSE of Big Lake, Alaska  earthquake   \n",
       "78557    nn00661286          13km E of Hawthorne, Nevada  earthquake   \n",
       "24307    nn00667978  10km NNW of Incline Village, Nevada  earthquake   \n",
       "12701    nc73178980          10km WNW of The Geysers, CA  earthquake   \n",
       "\n",
       "          status  \n",
       "37011   reviewed  \n",
       "84272   reviewed  \n",
       "78557   reviewed  \n",
       "24307   reviewed  \n",
       "12701  automatic  "
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq1_year.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "id": "A3B6FD55A45D454284F83D4C87C74245",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "earthquake            158194\n",
       "quarry blast            1173\n",
       "explosion               1023\n",
       "ice quake                776\n",
       "mining explosion         214\n",
       "other event              136\n",
       "volcanic eruption         28\n",
       "chemical explosion        15\n",
       "mine collapse              2\n",
       "sonic boom                 2\n",
       "rock burst                 2\n",
       "Name: type, dtype: int64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_type = eq1_year['type'].value_counts()\n",
    "eq_type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "id": "AB13216E70CB40F998515B5A597AEA01",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "earthquake            97.91\n",
       "quarry blast           0.73\n",
       "explosion              0.63\n",
       "ice quake              0.48\n",
       "mining explosion       0.13\n",
       "other event            0.08\n",
       "volcanic eruption      0.02\n",
       "chemical explosion     0.01\n",
       "mine collapse          0.00\n",
       "sonic boom             0.00\n",
       "rock burst             0.00\n",
       "Name: type, dtype: float64"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.round(eq_type/eq_type.sum()*100, 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "id": "FFE78D616C234F8783EF06EA7EBA6B85",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count                         161565\n",
       "unique                        161552\n",
       "top       2018-08-03 21:16:00.990000\n",
       "freq                               2\n",
       "first     2018-06-25 00:01:27.580000\n",
       "last      2019-06-24 06:52:27.530000\n",
       "Name: time, dtype: object"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq1_year['time'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "id": "E06D995EAAD94C6BB2B98718C5E11C9C",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "earthquake            158194\n",
       "quarry blast            1173\n",
       "explosion               1023\n",
       "ice quake                776\n",
       "mining explosion         214\n",
       "other event              136\n",
       "volcanic eruption         28\n",
       "chemical explosion        15\n",
       "mine collapse              2\n",
       "sonic boom                 2\n",
       "rock burst                 2\n",
       "Name: type, dtype: int64"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "id": "D7A0687FE7E048178A9EBB990582D477",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"efc7cb6c6f044fb1ace0d8d622d361ee\" style=\"width:800px;height:900px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_efc7cb6c6f044fb1ace0d8d622d361ee = echarts.init(document.getElementById('efc7cb6c6f044fb1ace0d8d622d361ee'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_efc7cb6c6f044fb1ace0d8d622d361ee = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd1\\u4e00\\u5e74\\u5168\\u7403\\u6240\\u6709\\u5730\\u9707\\u7684\\u5730\\u9707\\u7c7b\\u578b\",\n",
       "            \"subtext\": \"\\u65f6\\u95f4: 2018\\u5e746\\u670825\\u65e5\\u81f32019\\u5e746\\u670824\\u65e5\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 928428,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"sankey\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6784\\u9020\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u7136\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u706b\\u5c71\\u55b7\\u53d1\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u706b\\u5c71\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u51b0\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u584c\\u9677\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u77ff\\u4e95\\u584c\\u9677\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5ca9\\u7206\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91c7\\u77f3\\u573a\\u7206\\u7834\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7206\\u70b8\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7164\\u77ff\\u7206\\u70b8\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5316\\u5b66\\u7206\\u70b8\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4eba\\u5de5\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c34\\u5e93\\u5730\\u9707\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb9\\u7530\\u6ce8\\u6c34\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8bf1\\u53d1\\u5730\\u9707\"\n",
       "                }\n",
       "            ],\n",
       "            \"links\": [\n",
       "                {\n",
       "                    \"source\": \"\\u6784\\u9020\\u5730\\u9707\",\n",
       "                    \"target\": \"\\u5929\\u7136\\u5730\\u9707\",\n",
       "                    \"value\": 5000\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u706b\\u5c71\\u55b7\\u53d1\",\n",
       "                    \"target\": \"\\u706b\\u5c71\\u5730\\u9707\",\n",
       "                    \"value\": 28\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u706b\\u5c71\\u5730\\u9707\",\n",
       "                    \"target\": \"\\u5929\\u7136\\u5730\\u9707\",\n",
       "                    \"value\": 28\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u51b0\\u9707\",\n",
       "                    \"target\": \"\\u584c\\u9677\\u5730\\u9707\",\n",
       "                    \"value\": 776\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u77ff\\u4e95\\u584c\\u9677\",\n",
       "                    \"target\": \"\\u584c\\u9677\\u5730\\u9707\",\n",
       "                    \"value\": 2\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u5ca9\\u7206\",\n",
       "                    \"target\": \"\\u584c\\u9677\\u5730\\u9707\",\n",
       "                    \"value\": 2\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u584c\\u9677\\u5730\\u9707\",\n",
       "                    \"target\": \"\\u5929\\u7136\\u5730\\u9707\",\n",
       "                    \"value\": 780\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u91c7\\u77f3\\u573a\\u7206\\u7834\",\n",
       "                    \"target\": \"\\u4eba\\u5de5\\u5730\\u9707\",\n",
       "                    \"value\": 1173\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u7206\\u70b8\",\n",
       "                    \"target\": \"\\u4eba\\u5de5\\u5730\\u9707\",\n",
       "                    \"value\": 1023\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u7164\\u77ff\\u7206\\u70b8\",\n",
       "                    \"target\": \"\\u4eba\\u5de5\\u5730\\u9707\",\n",
       "                    \"value\": 214\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u5316\\u5b66\\u7206\\u70b8\",\n",
       "                    \"target\": \"\\u4eba\\u5de5\\u5730\\u9707\",\n",
       "                    \"value\": 15\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u6c34\\u5e93\\u5730\\u9707\",\n",
       "                    \"target\": \"\\u8bf1\\u53d1\\u5730\\u9707\",\n",
       "                    \"value\": 50\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u6cb9\\u7530\\u6ce8\\u6c34\",\n",
       "                    \"target\": \"\\u8bf1\\u53d1\\u5730\\u9707\",\n",
       "                    \"value\": 50\n",
       "                }\n",
       "            ],\n",
       "            \"nodeWidth\": 20,\n",
       "            \"nodeGap\": 8,\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"right\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 0.2,\n",
       "                    \"curveness\": 0.5,\n",
       "                    \"type\": \"solid\",\n",
       "                    \"color\": \"source\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_efc7cb6c6f044fb1ace0d8d622d361ee.setOption(option_efc7cb6c6f044fb1ace0d8d622d361ee);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.sankey.Sankey at 0x7f56658c9908>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Sankey\n",
    "\n",
    "nodes = [\n",
    "    {'name': '构造地震'}, {'name': '天然地震'}, {'name': '火山喷发'},\n",
    "    {'name': '火山地震'}, {'name': '冰震'}, {'name': '塌陷地震'},\n",
    "    {'name': '矿井塌陷'}, {'name': '岩爆'}, {'name': '采石场爆破'},\n",
    "    {'name': '爆炸'}, {'name': '煤矿爆炸'}, {'name': '化学爆炸'},\n",
    "    {'name': '人工地震'}, {'name': '水库地震'}, {'name': '油田注水'},\n",
    "    {'name': '诱发地震'}\n",
    "]\n",
    "\n",
    "links = [\n",
    "    {'source': '构造地震', 'target': '天然地震', 'value': 5000},  #为了图形显示，这里重置了构造地震真实值\n",
    "    {'source': '火山喷发', 'target': '火山地震', 'value': 28},\n",
    "    {'source': '火山地震', 'target': '天然地震', 'value': 28},\n",
    "    {'source': '冰震', 'target': '塌陷地震', 'value': 776},\n",
    "    {'source': '矿井塌陷', 'target': '塌陷地震', 'value': 2},\n",
    "    {'source': '岩爆', 'target': '塌陷地震', 'value': 2},\n",
    "    {'source': '塌陷地震', 'target': '天然地震', 'value': 780},\n",
    "    {'source': '采石场爆破', 'target': '人工地震', 'value': 1173},\n",
    "    {'source': '爆炸', 'target': '人工地震', 'value': 1023},\n",
    "    {'source': '煤矿爆炸', 'target': '人工地震', 'value': 214},\n",
    "    {'source': '化学爆炸', 'target': '人工地震', 'value': 15},\n",
    "    {'source': '水库地震', 'target': '诱发地震', 'value': 50},\n",
    "    {'source': '油田注水', 'target': '诱发地震', 'value': 50},\n",
    "]\n",
    "sankey = Sankey(\"近一年全球所有地震的地震类型\", \"时间: 2018年6月25日至2019年6月24日\", width=800, height=900)\n",
    "sankey.add(\n",
    "    \"\",\n",
    "    nodes,\n",
    "    links,\n",
    "    line_opacity=0.2,\n",
    "    line_curve=0.5,\n",
    "    line_color=\"source\",\n",
    "    is_label_show=True,\n",
    "    label_pos=\"right\",\n",
    ")\n",
    "sankey"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "id": "1299004954FE4060A8C68E2D6C7A04BC",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(161565, 10)"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq1_year.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "CB67136EDDC04348849A5FFB6DB1765F",
    "mdEditEnable": false
   },
   "source": [
    "#### 2.3 全世界地震频发的地区有哪些？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "id": "9E59EAE334D44D62808598676B5C973E",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(131865, 11)"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "id": "3FAFB84D4EDF49448D79084B7B73AEE0",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['time', 'latitude', 'longitude', 'depth', 'mag', 'magType', 'id',\n",
       "       'place', 'type', 'status', 'year'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "id": "522423C56857431E98F13D8D309D30E0",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_place = eq20_years.sample(30000)[['latitude', 'longitude', 'mag']]\n",
    "eq_place['latitude'] = eq_place['latitude'].astype(str)\n",
    "eq_place['longitude'] = eq_place['longitude'].astype(str)\n",
    "eq_place['latlon'] = eq_place['longitude'].str.cat(eq_place['latitude'], sep=',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "id": "ADDBDB7B79E741EB8EA4C66F3400BBC9",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_place.to_csv('eq_place.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "id": "267B9D3F152F413F84E753096DD96C67",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2343, 11)"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq20_years[eq20_years['mag'] > 6].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "id": "3F30AE44706240B1888C667C74D44C49",
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \n",
      "/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  This is separate from the ipykernel package so we can avoid doing imports until\n",
      "/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  after removing the cwd from sys.path.\n"
     ]
    }
   ],
   "source": [
    "eq_place_6 = eq20_years[eq20_years['mag'] > 6]\n",
    "eq_place_6['latitude'] = eq_place_6['latitude'].astype(str)\n",
    "eq_place_6['longitude'] = eq_place_6['longitude'].astype(str)\n",
    "eq_place_6['latlon'] = eq_place_6['longitude'].str.cat(eq_place_6['latitude'], sep=',')\n",
    "\n",
    "eq_place_6.to_csv('eq_place_6.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "id": "4E717B35323043CA9E36072C9247F5F6",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "region = []\n",
    "for l in eq20_years['place'].str.split(',').tolist():\n",
    "    try:\n",
    "        region.append(l[-1].strip())\n",
    "    except TypeError:\n",
    "        region.append(np.nan)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "id": "7276C6A564EC4B80842C6AFE9A8DB177",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq20_years['region'] = region"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "id": "628DBF62261D462EB42DF4860530AC5A",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Indonesia           15661\n",
       "Japan                9646\n",
       "Papua New Guinea     7827\n",
       "Chile                5249\n",
       "Philippines          4379\n",
       "Tonga                4167\n",
       "Vanuatu              3489\n",
       "New Zealand          2982\n",
       "Solomon Islands      2958\n",
       "Alaska               2700\n",
       "Japan region         2522\n",
       "Name: region, dtype: int64"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "region_top10 = eq20_years['region'].value_counts().nlargest(11)\n",
    "region_top10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "id": "C25212A7EE86461A8A5BBEC924BB9945",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"6990f6a5ea664deca93e29aeeab418a3\" style=\"width:900px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_6990f6a5ea664deca93e29aeeab418a3 = echarts.init(document.getElementById('6990f6a5ea664deca93e29aeeab418a3'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_6990f6a5ea664deca93e29aeeab418a3 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd120\\u5e74\\u5168\\u74034.5\\u7ea7\\u4ee5\\u4e0a\\u5730\\u9707\\u6b21\\u6570\\u6700\\u591a\\u7684\\u56fd\\u5bb6/\\u5730\\u533a\",\n",
       "            \"subtext\": \"\\u65f6\\u95f4: 2000\\u5e741\\u67081\\u65e5-2019\\u5e746\\u670824\\u65e5, \\u5355\\u4f4d:\\u6b21\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 658024,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"data\": [\n",
       "                15661,\n",
       "                12168,\n",
       "                7827,\n",
       "                5249,\n",
       "                4379,\n",
       "                4167,\n",
       "                3489,\n",
       "                2982,\n",
       "                2958,\n",
       "                2700\n",
       "            ],\n",
       "            \"stack\": \"stack_658024\",\n",
       "            \"barCategoryGap\": \"40%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 18\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 658024\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 11\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5370\\u5c3c\",\n",
       "                \"\\u65e5\\u672c\",\n",
       "                \"\\u65b0\\u51e0\\u5185\\u4e9a\",\n",
       "                \"\\u667a\\u5229\",\n",
       "                \"\\u83f2\\u5f8b\\u5bbe\",\n",
       "                \"\\u6c64\\u52a0\",\n",
       "                \"\\u74e6\\u52aa\\u963f\\u56fe\",\n",
       "                \"\\u65b0\\u897f\\u5170\",\n",
       "                \"\\u6240\\u7f57\\u95e8\\u7fa4\\u5c9b\",\n",
       "                \"\\u963f\\u62c9\\u65af\\u52a0\\u5dde\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"value\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 20\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_6990f6a5ea664deca93e29aeeab418a3.setOption(option_6990f6a5ea664deca93e29aeeab418a3);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x7f56609970f0>"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Bar\n",
    "\n",
    "\n",
    "r = ['印尼', '日本', '新几内亚', '智利', '菲律宾', '汤加', '瓦努阿图', '新西兰', '所罗门群岛', '阿拉斯加州']\n",
    "num = [15661, 9646+2522, 7827, 5249, 4379, 4167, 3489, 2982, 2958, 2700]\n",
    "bar = Bar(\"近20年全球4.5级以上地震次数最多的国家/地区\", \"时间: 2000年1月1日-2019年6月24日, 单位:次\", width=900)\n",
    "bar.add(\"\", r, num, \n",
    "        is_stack=True,  bar_category_gap='40%', label_text_size=18, \n",
    "        xaxis_label_textsize=11,yaxis_label_textsize=20, xaxis_rotate=0)\n",
    "\n",
    "bar"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "BFAECD0E8DAE4E4989C066DC3986F260",
    "mdEditEnable": false
   },
   "source": [
    "#### 2.4 近20年有哪些引发全世界舆情关注的大地震？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "id": "CBA3A3D1606A4CB3969D09171780C49D",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_gt_6 = eq20_years[eq20_years['mag'] > 6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "id": "F9119D2BD13543BFA03EB1997F96A4DB",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2041"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_gt_6[eq_gt_6['mag']<7].shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "id": "9574E33CE94149439DA37705AD256F12",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "278"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_gt_6[(eq_gt_6['mag']>=7)&(eq_gt_6['mag']<8)].shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "id": "4436A7453D0E48A980D23062FF90FBF9",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "22"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_gt_6[(eq_gt_6['mag']>=8)&(eq_gt_6['mag']<9)].shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "id": "EB9FCC87E1B94ED1B17A0C695FB782DC",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_gt_6[eq_gt_6['mag']>=9].shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "id": "3574ABE96272401187B83DB3C6FC70B4",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_gt_7 = eq20_years[eq20_years['mag'] > 7]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "id": "FDB7BFFED80B4815BD5778AAD9F6FAF4",
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "eq_gt_7['influence'] = eq_gt_7['mag'] + np.round(10/(eq_gt_7['depth']+5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "id": "69723DB4D0FF4A27AD83D00F5FC3A20C",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>id</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>status</th>\n",
       "      <th>year</th>\n",
       "      <th>region</th>\n",
       "      <th>influence</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2011-03-11 05:46:24.120</th>\n",
       "      <td>2011-03-11 05:46:24.120</td>\n",
       "      <td>38.2970</td>\n",
       "      <td>142.3730</td>\n",
       "      <td>29.00</td>\n",
       "      <td>9.1</td>\n",
       "      <td>mww</td>\n",
       "      <td>official20110311054624120_30</td>\n",
       "      <td>2011 Great Tohoku Earthquake, Japan</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2011</td>\n",
       "      <td>Japan</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-12-26 00:58:53.450</th>\n",
       "      <td>2004-12-26 00:58:53.450</td>\n",
       "      <td>3.2950</td>\n",
       "      <td>95.9820</td>\n",
       "      <td>30.00</td>\n",
       "      <td>9.1</td>\n",
       "      <td>mw</td>\n",
       "      <td>official20041226005853450_30</td>\n",
       "      <td>2004 Sumatra - Andaman Islands Earthquake</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2004</td>\n",
       "      <td>2004 Sumatra - Andaman Islands Earthquake</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-02-27 06:34:11.530</th>\n",
       "      <td>2010-02-27 06:34:11.530</td>\n",
       "      <td>-36.1220</td>\n",
       "      <td>-72.8980</td>\n",
       "      <td>22.90</td>\n",
       "      <td>8.8</td>\n",
       "      <td>mww</td>\n",
       "      <td>official20100227063411530_30</td>\n",
       "      <td>offshore Bio-Bio, Chile</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2010</td>\n",
       "      <td>Chile</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-04-11 08:38:36.720</th>\n",
       "      <td>2012-04-11 08:38:36.720</td>\n",
       "      <td>2.3270</td>\n",
       "      <td>93.0630</td>\n",
       "      <td>20.00</td>\n",
       "      <td>8.6</td>\n",
       "      <td>mw</td>\n",
       "      <td>official20120411083836720_20</td>\n",
       "      <td>off the west coast of northern Sumatra</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2012</td>\n",
       "      <td>off the west coast of northern Sumatra</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2005-03-28 16:09:36.530</th>\n",
       "      <td>2005-03-28 16:09:36.530</td>\n",
       "      <td>2.0850</td>\n",
       "      <td>97.1080</td>\n",
       "      <td>30.00</td>\n",
       "      <td>8.6</td>\n",
       "      <td>mww</td>\n",
       "      <td>official20050328160936530_30</td>\n",
       "      <td>northern Sumatra, Indonesia</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2005</td>\n",
       "      <td>Indonesia</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-06-23 20:33:14.130</th>\n",
       "      <td>2001-06-23 20:33:14.130</td>\n",
       "      <td>-16.2650</td>\n",
       "      <td>-73.6410</td>\n",
       "      <td>33.00</td>\n",
       "      <td>8.4</td>\n",
       "      <td>mww</td>\n",
       "      <td>official20010623203314130_33</td>\n",
       "      <td>near the coast of southern Peru</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2001</td>\n",
       "      <td>near the coast of southern Peru</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007-09-12 11:10:26.830</th>\n",
       "      <td>2007-09-12 11:10:26.830</td>\n",
       "      <td>-4.4380</td>\n",
       "      <td>101.3670</td>\n",
       "      <td>34.00</td>\n",
       "      <td>8.4</td>\n",
       "      <td>mww</td>\n",
       "      <td>official20070912111026830_34</td>\n",
       "      <td>southern Sumatra, Indonesia</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2007</td>\n",
       "      <td>Indonesia</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2006-11-15 11:14:13.570</th>\n",
       "      <td>2006-11-15 11:14:13.570</td>\n",
       "      <td>46.5920</td>\n",
       "      <td>153.2660</td>\n",
       "      <td>10.00</td>\n",
       "      <td>8.3</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000exfn</td>\n",
       "      <td>Kuril Islands</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2006</td>\n",
       "      <td>Kuril Islands</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-09-16 22:54:32.860</th>\n",
       "      <td>2015-09-16 22:54:32.860</td>\n",
       "      <td>-31.5729</td>\n",
       "      <td>-71.6744</td>\n",
       "      <td>22.44</td>\n",
       "      <td>8.3</td>\n",
       "      <td>mww</td>\n",
       "      <td>us20003k7a</td>\n",
       "      <td>48km W of Illapel, Chile</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2015</td>\n",
       "      <td>Chile</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003-09-25 19:50:06.360</th>\n",
       "      <td>2003-09-25 19:50:06.360</td>\n",
       "      <td>41.8150</td>\n",
       "      <td>143.9100</td>\n",
       "      <td>27.00</td>\n",
       "      <td>8.3</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000c8kv</td>\n",
       "      <td>Hokkaido, Japan region</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2003</td>\n",
       "      <td>Japan region</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-05-24 05:44:48.980</th>\n",
       "      <td>2013-05-24 05:44:48.980</td>\n",
       "      <td>54.8920</td>\n",
       "      <td>153.2210</td>\n",
       "      <td>598.10</td>\n",
       "      <td>8.3</td>\n",
       "      <td>mww</td>\n",
       "      <td>usb000h4jh</td>\n",
       "      <td>Sea of Okhotsk</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2013</td>\n",
       "      <td>Sea of Okhotsk</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-04-01 23:46:47.260</th>\n",
       "      <td>2014-04-01 23:46:47.260</td>\n",
       "      <td>-19.6097</td>\n",
       "      <td>-70.7691</td>\n",
       "      <td>25.00</td>\n",
       "      <td>8.2</td>\n",
       "      <td>mww</td>\n",
       "      <td>usc000nzvd</td>\n",
       "      <td>94km NW of Iquique, Chile</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2014</td>\n",
       "      <td>Chile</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-04-11 10:43:10.850</th>\n",
       "      <td>2012-04-11 10:43:10.850</td>\n",
       "      <td>0.8020</td>\n",
       "      <td>92.4630</td>\n",
       "      <td>25.10</td>\n",
       "      <td>8.2</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000jhjb</td>\n",
       "      <td>off the west coast of northern Sumatra</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2012</td>\n",
       "      <td>off the west coast of northern Sumatra</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-08 04:49:19.180</th>\n",
       "      <td>2017-09-08 04:49:19.180</td>\n",
       "      <td>15.0222</td>\n",
       "      <td>-93.8993</td>\n",
       "      <td>47.39</td>\n",
       "      <td>8.2</td>\n",
       "      <td>mww</td>\n",
       "      <td>us2000ahv0</td>\n",
       "      <td>101km SSW of Tres Picos, Mexico</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2017</td>\n",
       "      <td>Mexico</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-08-19 00:19:40.670</th>\n",
       "      <td>2018-08-19 00:19:40.670</td>\n",
       "      <td>-18.1125</td>\n",
       "      <td>-178.1530</td>\n",
       "      <td>600.00</td>\n",
       "      <td>8.2</td>\n",
       "      <td>mww</td>\n",
       "      <td>us1000gcii</td>\n",
       "      <td>286km NNE of Ndoi Island, Fiji</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2018</td>\n",
       "      <td>Fiji</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007-01-13 04:23:21.160</th>\n",
       "      <td>2007-01-13 04:23:21.160</td>\n",
       "      <td>46.2430</td>\n",
       "      <td>154.5240</td>\n",
       "      <td>10.00</td>\n",
       "      <td>8.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000f2ab</td>\n",
       "      <td>east of the Kuril Islands</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2007</td>\n",
       "      <td>east of the Kuril Islands</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-12-23 14:59:04.410</th>\n",
       "      <td>2004-12-23 14:59:04.410</td>\n",
       "      <td>-49.3120</td>\n",
       "      <td>161.3450</td>\n",
       "      <td>10.00</td>\n",
       "      <td>8.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000db93</td>\n",
       "      <td>north of Macquarie Island</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2004</td>\n",
       "      <td>north of Macquarie Island</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-09-29 17:48:10.990</th>\n",
       "      <td>2009-09-29 17:48:10.990</td>\n",
       "      <td>-15.4890</td>\n",
       "      <td>-172.0950</td>\n",
       "      <td>18.00</td>\n",
       "      <td>8.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000h1ys</td>\n",
       "      <td>Samoa Islands region</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2009</td>\n",
       "      <td>Samoa Islands region</td>\n",
       "      <td>8.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007-04-01 20:39:58.710</th>\n",
       "      <td>2007-04-01 20:39:58.710</td>\n",
       "      <td>-8.4660</td>\n",
       "      <td>157.0430</td>\n",
       "      <td>24.00</td>\n",
       "      <td>8.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000f83m</td>\n",
       "      <td>Solomon Islands</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2007</td>\n",
       "      <td>Solomon Islands</td>\n",
       "      <td>8.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-02-06 01:12:25.830</th>\n",
       "      <td>2013-02-06 01:12:25.830</td>\n",
       "      <td>-10.7990</td>\n",
       "      <td>165.1140</td>\n",
       "      <td>24.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>mww</td>\n",
       "      <td>usc000f1s0</td>\n",
       "      <td>76km W of Lata, Solomon Islands</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2013</td>\n",
       "      <td>Solomon Islands</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-11-16 04:54:56.740</th>\n",
       "      <td>2000-11-16 04:54:56.740</td>\n",
       "      <td>-3.9800</td>\n",
       "      <td>152.1690</td>\n",
       "      <td>33.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000a3qq</td>\n",
       "      <td>New Ireland region, Papua New Guinea</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2000</td>\n",
       "      <td>Papua New Guinea</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007-08-15 23:40:57.890</th>\n",
       "      <td>2007-08-15 23:40:57.890</td>\n",
       "      <td>-13.3860</td>\n",
       "      <td>-76.6030</td>\n",
       "      <td>39.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000fjta</td>\n",
       "      <td>near the coast of central Peru</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2007</td>\n",
       "      <td>near the coast of central Peru</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2006-05-03 15:26:40.290</th>\n",
       "      <td>2006-05-03 15:26:40.290</td>\n",
       "      <td>-20.1870</td>\n",
       "      <td>-174.1230</td>\n",
       "      <td>55.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000eg5g</td>\n",
       "      <td>Tonga</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2006</td>\n",
       "      <td>Tonga</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-05-26 07:41:15.058</th>\n",
       "      <td>2019-05-26 07:41:15.058</td>\n",
       "      <td>-5.8132</td>\n",
       "      <td>-75.2775</td>\n",
       "      <td>122.40</td>\n",
       "      <td>8.0</td>\n",
       "      <td>mww</td>\n",
       "      <td>us60003sc0</td>\n",
       "      <td>78km SE of Lagunas, Peru</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2019</td>\n",
       "      <td>Peru</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2002-11-03 22:12:41.518</th>\n",
       "      <td>2002-11-03 22:12:41.518</td>\n",
       "      <td>63.5141</td>\n",
       "      <td>-147.4529</td>\n",
       "      <td>4.20</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mw</td>\n",
       "      <td>ak002e435qpj</td>\n",
       "      <td>Central Alaska</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2002</td>\n",
       "      <td>Central Alaska</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-06-18 14:44:13.310</th>\n",
       "      <td>2000-06-18 14:44:13.310</td>\n",
       "      <td>-13.8020</td>\n",
       "      <td>97.4530</td>\n",
       "      <td>10.00</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp0009ut0</td>\n",
       "      <td>South Indian Ocean</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2000</td>\n",
       "      <td>South Indian Ocean</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-23 09:31:40.890</th>\n",
       "      <td>2018-01-23 09:31:40.890</td>\n",
       "      <td>56.0039</td>\n",
       "      <td>-149.1658</td>\n",
       "      <td>14.06</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mww</td>\n",
       "      <td>us2000cmy3</td>\n",
       "      <td>280km SE of Kodiak, Alaska</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2018</td>\n",
       "      <td>Alaska</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2008-05-12 06:28:01.570</th>\n",
       "      <td>2008-05-12 06:28:01.570</td>\n",
       "      <td>31.0020</td>\n",
       "      <td>103.3220</td>\n",
       "      <td>19.00</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000g650</td>\n",
       "      <td>eastern Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2008</td>\n",
       "      <td>China</td>\n",
       "      <td>7.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-06-04 16:28:26.170</th>\n",
       "      <td>2000-06-04 16:28:26.170</td>\n",
       "      <td>-4.7210</td>\n",
       "      <td>102.0870</td>\n",
       "      <td>33.00</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp0009txv</td>\n",
       "      <td>southern Sumatra, Indonesia</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2000</td>\n",
       "      <td>Indonesia</td>\n",
       "      <td>7.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007-09-12 23:49:03.720</th>\n",
       "      <td>2007-09-12 23:49:03.720</td>\n",
       "      <td>-2.6250</td>\n",
       "      <td>100.8410</td>\n",
       "      <td>35.00</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000fn2b</td>\n",
       "      <td>Kepulauan Mentawai region, Indonesia</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2007</td>\n",
       "      <td>Indonesia</td>\n",
       "      <td>7.9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           time  latitude  longitude   depth  \\\n",
       "time                                                                           \n",
       "2011-03-11 05:46:24.120 2011-03-11 05:46:24.120   38.2970   142.3730   29.00   \n",
       "2004-12-26 00:58:53.450 2004-12-26 00:58:53.450    3.2950    95.9820   30.00   \n",
       "2010-02-27 06:34:11.530 2010-02-27 06:34:11.530  -36.1220   -72.8980   22.90   \n",
       "2012-04-11 08:38:36.720 2012-04-11 08:38:36.720    2.3270    93.0630   20.00   \n",
       "2005-03-28 16:09:36.530 2005-03-28 16:09:36.530    2.0850    97.1080   30.00   \n",
       "2001-06-23 20:33:14.130 2001-06-23 20:33:14.130  -16.2650   -73.6410   33.00   \n",
       "2007-09-12 11:10:26.830 2007-09-12 11:10:26.830   -4.4380   101.3670   34.00   \n",
       "2006-11-15 11:14:13.570 2006-11-15 11:14:13.570   46.5920   153.2660   10.00   \n",
       "2015-09-16 22:54:32.860 2015-09-16 22:54:32.860  -31.5729   -71.6744   22.44   \n",
       "2003-09-25 19:50:06.360 2003-09-25 19:50:06.360   41.8150   143.9100   27.00   \n",
       "2013-05-24 05:44:48.980 2013-05-24 05:44:48.980   54.8920   153.2210  598.10   \n",
       "2014-04-01 23:46:47.260 2014-04-01 23:46:47.260  -19.6097   -70.7691   25.00   \n",
       "2012-04-11 10:43:10.850 2012-04-11 10:43:10.850    0.8020    92.4630   25.10   \n",
       "2017-09-08 04:49:19.180 2017-09-08 04:49:19.180   15.0222   -93.8993   47.39   \n",
       "2018-08-19 00:19:40.670 2018-08-19 00:19:40.670  -18.1125  -178.1530  600.00   \n",
       "2007-01-13 04:23:21.160 2007-01-13 04:23:21.160   46.2430   154.5240   10.00   \n",
       "2004-12-23 14:59:04.410 2004-12-23 14:59:04.410  -49.3120   161.3450   10.00   \n",
       "2009-09-29 17:48:10.990 2009-09-29 17:48:10.990  -15.4890  -172.0950   18.00   \n",
       "2007-04-01 20:39:58.710 2007-04-01 20:39:58.710   -8.4660   157.0430   24.00   \n",
       "2013-02-06 01:12:25.830 2013-02-06 01:12:25.830  -10.7990   165.1140   24.00   \n",
       "2000-11-16 04:54:56.740 2000-11-16 04:54:56.740   -3.9800   152.1690   33.00   \n",
       "2007-08-15 23:40:57.890 2007-08-15 23:40:57.890  -13.3860   -76.6030   39.00   \n",
       "2006-05-03 15:26:40.290 2006-05-03 15:26:40.290  -20.1870  -174.1230   55.00   \n",
       "2019-05-26 07:41:15.058 2019-05-26 07:41:15.058   -5.8132   -75.2775  122.40   \n",
       "2002-11-03 22:12:41.518 2002-11-03 22:12:41.518   63.5141  -147.4529    4.20   \n",
       "2000-06-18 14:44:13.310 2000-06-18 14:44:13.310  -13.8020    97.4530   10.00   \n",
       "2018-01-23 09:31:40.890 2018-01-23 09:31:40.890   56.0039  -149.1658   14.06   \n",
       "2008-05-12 06:28:01.570 2008-05-12 06:28:01.570   31.0020   103.3220   19.00   \n",
       "2000-06-04 16:28:26.170 2000-06-04 16:28:26.170   -4.7210   102.0870   33.00   \n",
       "2007-09-12 23:49:03.720 2007-09-12 23:49:03.720   -2.6250   100.8410   35.00   \n",
       "\n",
       "                         mag magType                            id  \\\n",
       "time                                                                 \n",
       "2011-03-11 05:46:24.120  9.1     mww  official20110311054624120_30   \n",
       "2004-12-26 00:58:53.450  9.1      mw  official20041226005853450_30   \n",
       "2010-02-27 06:34:11.530  8.8     mww  official20100227063411530_30   \n",
       "2012-04-11 08:38:36.720  8.6      mw  official20120411083836720_20   \n",
       "2005-03-28 16:09:36.530  8.6     mww  official20050328160936530_30   \n",
       "2001-06-23 20:33:14.130  8.4     mww  official20010623203314130_33   \n",
       "2007-09-12 11:10:26.830  8.4     mww  official20070912111026830_34   \n",
       "2006-11-15 11:14:13.570  8.3     mwc                    usp000exfn   \n",
       "2015-09-16 22:54:32.860  8.3     mww                    us20003k7a   \n",
       "2003-09-25 19:50:06.360  8.3     mwc                    usp000c8kv   \n",
       "2013-05-24 05:44:48.980  8.3     mww                    usb000h4jh   \n",
       "2014-04-01 23:46:47.260  8.2     mww                    usc000nzvd   \n",
       "2012-04-11 10:43:10.850  8.2     mwc                    usp000jhjb   \n",
       "2017-09-08 04:49:19.180  8.2     mww                    us2000ahv0   \n",
       "2018-08-19 00:19:40.670  8.2     mww                    us1000gcii   \n",
       "2007-01-13 04:23:21.160  8.1     mwc                    usp000f2ab   \n",
       "2004-12-23 14:59:04.410  8.1     mwc                    usp000db93   \n",
       "2009-09-29 17:48:10.990  8.1     mwc                    usp000h1ys   \n",
       "2007-04-01 20:39:58.710  8.1     mwc                    usp000f83m   \n",
       "2013-02-06 01:12:25.830  8.0     mww                    usc000f1s0   \n",
       "2000-11-16 04:54:56.740  8.0     mwc                    usp000a3qq   \n",
       "2007-08-15 23:40:57.890  8.0     mwc                    usp000fjta   \n",
       "2006-05-03 15:26:40.290  8.0     mwc                    usp000eg5g   \n",
       "2019-05-26 07:41:15.058  8.0     mww                    us60003sc0   \n",
       "2002-11-03 22:12:41.518  7.9      mw                  ak002e435qpj   \n",
       "2000-06-18 14:44:13.310  7.9     mwc                    usp0009ut0   \n",
       "2018-01-23 09:31:40.890  7.9     mww                    us2000cmy3   \n",
       "2008-05-12 06:28:01.570  7.9     mwc                    usp000g650   \n",
       "2000-06-04 16:28:26.170  7.9     mwc                    usp0009txv   \n",
       "2007-09-12 23:49:03.720  7.9     mwc                    usp000fn2b   \n",
       "\n",
       "                                                             place  \\\n",
       "time                                                                 \n",
       "2011-03-11 05:46:24.120        2011 Great Tohoku Earthquake, Japan   \n",
       "2004-12-26 00:58:53.450  2004 Sumatra - Andaman Islands Earthquake   \n",
       "2010-02-27 06:34:11.530                    offshore Bio-Bio, Chile   \n",
       "2012-04-11 08:38:36.720     off the west coast of northern Sumatra   \n",
       "2005-03-28 16:09:36.530                northern Sumatra, Indonesia   \n",
       "2001-06-23 20:33:14.130            near the coast of southern Peru   \n",
       "2007-09-12 11:10:26.830                southern Sumatra, Indonesia   \n",
       "2006-11-15 11:14:13.570                              Kuril Islands   \n",
       "2015-09-16 22:54:32.860                   48km W of Illapel, Chile   \n",
       "2003-09-25 19:50:06.360                     Hokkaido, Japan region   \n",
       "2013-05-24 05:44:48.980                             Sea of Okhotsk   \n",
       "2014-04-01 23:46:47.260                  94km NW of Iquique, Chile   \n",
       "2012-04-11 10:43:10.850     off the west coast of northern Sumatra   \n",
       "2017-09-08 04:49:19.180            101km SSW of Tres Picos, Mexico   \n",
       "2018-08-19 00:19:40.670             286km NNE of Ndoi Island, Fiji   \n",
       "2007-01-13 04:23:21.160                  east of the Kuril Islands   \n",
       "2004-12-23 14:59:04.410                  north of Macquarie Island   \n",
       "2009-09-29 17:48:10.990                       Samoa Islands region   \n",
       "2007-04-01 20:39:58.710                            Solomon Islands   \n",
       "2013-02-06 01:12:25.830            76km W of Lata, Solomon Islands   \n",
       "2000-11-16 04:54:56.740       New Ireland region, Papua New Guinea   \n",
       "2007-08-15 23:40:57.890             near the coast of central Peru   \n",
       "2006-05-03 15:26:40.290                                      Tonga   \n",
       "2019-05-26 07:41:15.058                   78km SE of Lagunas, Peru   \n",
       "2002-11-03 22:12:41.518                             Central Alaska   \n",
       "2000-06-18 14:44:13.310                         South Indian Ocean   \n",
       "2018-01-23 09:31:40.890                 280km SE of Kodiak, Alaska   \n",
       "2008-05-12 06:28:01.570                     eastern Sichuan, China   \n",
       "2000-06-04 16:28:26.170                southern Sumatra, Indonesia   \n",
       "2007-09-12 23:49:03.720       Kepulauan Mentawai region, Indonesia   \n",
       "\n",
       "                               type    status  year  \\\n",
       "time                                                  \n",
       "2011-03-11 05:46:24.120  earthquake  reviewed  2011   \n",
       "2004-12-26 00:58:53.450  earthquake  reviewed  2004   \n",
       "2010-02-27 06:34:11.530  earthquake  reviewed  2010   \n",
       "2012-04-11 08:38:36.720  earthquake  reviewed  2012   \n",
       "2005-03-28 16:09:36.530  earthquake  reviewed  2005   \n",
       "2001-06-23 20:33:14.130  earthquake  reviewed  2001   \n",
       "2007-09-12 11:10:26.830  earthquake  reviewed  2007   \n",
       "2006-11-15 11:14:13.570  earthquake  reviewed  2006   \n",
       "2015-09-16 22:54:32.860  earthquake  reviewed  2015   \n",
       "2003-09-25 19:50:06.360  earthquake  reviewed  2003   \n",
       "2013-05-24 05:44:48.980  earthquake  reviewed  2013   \n",
       "2014-04-01 23:46:47.260  earthquake  reviewed  2014   \n",
       "2012-04-11 10:43:10.850  earthquake  reviewed  2012   \n",
       "2017-09-08 04:49:19.180  earthquake  reviewed  2017   \n",
       "2018-08-19 00:19:40.670  earthquake  reviewed  2018   \n",
       "2007-01-13 04:23:21.160  earthquake  reviewed  2007   \n",
       "2004-12-23 14:59:04.410  earthquake  reviewed  2004   \n",
       "2009-09-29 17:48:10.990  earthquake  reviewed  2009   \n",
       "2007-04-01 20:39:58.710  earthquake  reviewed  2007   \n",
       "2013-02-06 01:12:25.830  earthquake  reviewed  2013   \n",
       "2000-11-16 04:54:56.740  earthquake  reviewed  2000   \n",
       "2007-08-15 23:40:57.890  earthquake  reviewed  2007   \n",
       "2006-05-03 15:26:40.290  earthquake  reviewed  2006   \n",
       "2019-05-26 07:41:15.058  earthquake  reviewed  2019   \n",
       "2002-11-03 22:12:41.518  earthquake  reviewed  2002   \n",
       "2000-06-18 14:44:13.310  earthquake  reviewed  2000   \n",
       "2018-01-23 09:31:40.890  earthquake  reviewed  2018   \n",
       "2008-05-12 06:28:01.570  earthquake  reviewed  2008   \n",
       "2000-06-04 16:28:26.170  earthquake  reviewed  2000   \n",
       "2007-09-12 23:49:03.720  earthquake  reviewed  2007   \n",
       "\n",
       "                                                            region  influence  \n",
       "time                                                                           \n",
       "2011-03-11 05:46:24.120                                      Japan        9.1  \n",
       "2004-12-26 00:58:53.450  2004 Sumatra - Andaman Islands Earthquake        9.1  \n",
       "2010-02-27 06:34:11.530                                      Chile        8.8  \n",
       "2012-04-11 08:38:36.720     off the west coast of northern Sumatra        8.6  \n",
       "2005-03-28 16:09:36.530                                  Indonesia        8.6  \n",
       "2001-06-23 20:33:14.130            near the coast of southern Peru        8.4  \n",
       "2007-09-12 11:10:26.830                                  Indonesia        8.4  \n",
       "2006-11-15 11:14:13.570                              Kuril Islands        9.3  \n",
       "2015-09-16 22:54:32.860                                      Chile        8.3  \n",
       "2003-09-25 19:50:06.360                               Japan region        8.3  \n",
       "2013-05-24 05:44:48.980                             Sea of Okhotsk        8.3  \n",
       "2014-04-01 23:46:47.260                                      Chile        8.2  \n",
       "2012-04-11 10:43:10.850     off the west coast of northern Sumatra        8.2  \n",
       "2017-09-08 04:49:19.180                                     Mexico        8.2  \n",
       "2018-08-19 00:19:40.670                                       Fiji        8.2  \n",
       "2007-01-13 04:23:21.160                  east of the Kuril Islands        9.1  \n",
       "2004-12-23 14:59:04.410                  north of Macquarie Island        9.1  \n",
       "2009-09-29 17:48:10.990                       Samoa Islands region        8.1  \n",
       "2007-04-01 20:39:58.710                            Solomon Islands        8.1  \n",
       "2013-02-06 01:12:25.830                            Solomon Islands        8.0  \n",
       "2000-11-16 04:54:56.740                           Papua New Guinea        8.0  \n",
       "2007-08-15 23:40:57.890             near the coast of central Peru        8.0  \n",
       "2006-05-03 15:26:40.290                                      Tonga        8.0  \n",
       "2019-05-26 07:41:15.058                                       Peru        8.0  \n",
       "2002-11-03 22:12:41.518                             Central Alaska        8.9  \n",
       "2000-06-18 14:44:13.310                         South Indian Ocean        8.9  \n",
       "2018-01-23 09:31:40.890                                     Alaska        8.9  \n",
       "2008-05-12 06:28:01.570                                      China        7.9  \n",
       "2000-06-04 16:28:26.170                                  Indonesia        7.9  \n",
       "2007-09-12 23:49:03.720                                  Indonesia        7.9  "
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_gt_7.loc[eq_gt_7.sort_values(by=['mag', 'depth'], ascending=[False, True]).index].head(30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "id": "7C0FCAA71F3E4FCD80BDB29105940094",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_gt_7.to_csv('eq_gt_7.csv', index=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "9ED61D509CD34E1D8AFF110A06532F71",
    "mdEditEnable": false
   },
   "source": [
    "#### 2.5 为什么四川省及其周围好像从2008年开始就地震频发？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "id": "7F8B56A87F474ED78C9D61E292A77C0F",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>id</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>2014-08-03 13:47:09.950</td>\n",
       "      <td>27.2425</td>\n",
       "      <td>103.3889</td>\n",
       "      <td>10.00</td>\n",
       "      <td>4.6</td>\n",
       "      <td>mb</td>\n",
       "      <td>usb000rznf</td>\n",
       "      <td>14km WNW of Wenping, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>484</th>\n",
       "      <td>2008-05-14 14:05:28.020</td>\n",
       "      <td>31.3430</td>\n",
       "      <td>103.8100</td>\n",
       "      <td>10.00</td>\n",
       "      <td>4.5</td>\n",
       "      <td>mb</td>\n",
       "      <td>usp000g6qm</td>\n",
       "      <td>eastern Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>254</th>\n",
       "      <td>2011-11-07 09:43:44.320</td>\n",
       "      <td>30.1630</td>\n",
       "      <td>97.5030</td>\n",
       "      <td>48.90</td>\n",
       "      <td>4.7</td>\n",
       "      <td>mb</td>\n",
       "      <td>usp000jagx</td>\n",
       "      <td>eastern Xizang</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>2017-02-02 00:34:33.470</td>\n",
       "      <td>28.1777</td>\n",
       "      <td>104.7993</td>\n",
       "      <td>33.37</td>\n",
       "      <td>4.6</td>\n",
       "      <td>mb</td>\n",
       "      <td>us20008fsq</td>\n",
       "      <td>28km E of Junlian, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>457</th>\n",
       "      <td>2008-05-19 06:06:54.760</td>\n",
       "      <td>32.4510</td>\n",
       "      <td>105.2720</td>\n",
       "      <td>10.00</td>\n",
       "      <td>5.2</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000g77g</td>\n",
       "      <td>Sichuan-Gansu border region, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       time  latitude  longitude  depth  mag magType  \\\n",
       "144 2014-08-03 13:47:09.950   27.2425   103.3889  10.00  4.6      mb   \n",
       "484 2008-05-14 14:05:28.020   31.3430   103.8100  10.00  4.5      mb   \n",
       "254 2011-11-07 09:43:44.320   30.1630    97.5030  48.90  4.7      mb   \n",
       "71  2017-02-02 00:34:33.470   28.1777   104.7993  33.37  4.6      mb   \n",
       "457 2008-05-19 06:06:54.760   32.4510   105.2720  10.00  5.2     mwc   \n",
       "\n",
       "             id                               place        type    status  \n",
       "144  usb000rznf          14km WNW of Wenping, China  earthquake  reviewed  \n",
       "484  usp000g6qm              eastern Sichuan, China  earthquake  reviewed  \n",
       "254  usp000jagx                      eastern Xizang  earthquake  reviewed  \n",
       "71   us20008fsq            28km E of Junlian, China  earthquake  reviewed  \n",
       "457  usp000g77g  Sichuan-Gansu border region, China  earthquake  reviewed  "
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "id": "C773E740E9194092BCA967D8F6524983",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>mag</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1073.000000</td>\n",
       "      <td>1073.000000</td>\n",
       "      <td>1073.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>30.260878</td>\n",
       "      <td>102.387508</td>\n",
       "      <td>4.803914</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>2.324542</td>\n",
       "      <td>2.668046</td>\n",
       "      <td>0.352342</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>25.820000</td>\n",
       "      <td>96.504000</td>\n",
       "      <td>4.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>28.264900</td>\n",
       "      <td>100.099000</td>\n",
       "      <td>4.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>30.883000</td>\n",
       "      <td>103.473700</td>\n",
       "      <td>4.700000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>31.829000</td>\n",
       "      <td>104.315000</td>\n",
       "      <td>4.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>35.624000</td>\n",
       "      <td>108.807600</td>\n",
       "      <td>7.900000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          latitude    longitude          mag\n",
       "count  1073.000000  1073.000000  1073.000000\n",
       "mean     30.260878   102.387508     4.803914\n",
       "std       2.324542     2.668046     0.352342\n",
       "min      25.820000    96.504000     4.500000\n",
       "25%      28.264900   100.099000     4.600000\n",
       "50%      30.883000   103.473700     4.700000\n",
       "75%      31.829000   104.315000     4.900000\n",
       "max      35.624000   108.807600     7.900000"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan[['latitude', 'longitude', 'mag']].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "id": "29A6A1E9A275491CB531116928053FAA",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count                           1073\n",
       "unique                          1073\n",
       "top       2019-02-23 21:38:10.120000\n",
       "freq                               1\n",
       "first     1979-08-05 05:18:22.500000\n",
       "last      2019-06-24 01:23:16.859000\n",
       "Name: time, dtype: object"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan['time'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "id": "CAE9DF06A51745CF8F8FD2AF0309FE8E",
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1073 entries, 0 to 1072\n",
      "Data columns (total 10 columns):\n",
      "time         1073 non-null datetime64[ns]\n",
      "latitude     1073 non-null float64\n",
      "longitude    1073 non-null float64\n",
      "depth        1073 non-null float64\n",
      "mag          1073 non-null float64\n",
      "magType      1073 non-null object\n",
      "id           1073 non-null object\n",
      "place        1073 non-null object\n",
      "type         1073 non-null object\n",
      "status       1073 non-null object\n",
      "dtypes: datetime64[ns](1), float64(4), object(5)\n",
      "memory usage: 83.9+ KB\n"
     ]
    }
   ],
   "source": [
    "eq_sichuan.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "id": "3383C892C18D4F5BB3A946F3B346A1B9",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_sichuan['year'] = eq_sichuan['time'].dt.year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "id": "57762DF671FD479DB7ECACD554428D8B",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_sichuan_years = eq_sichuan.groupby('year')['id'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "id": "1C0C4854C1724A68932BBFE91C3571B1",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"efee03256b484be898e9ad6456576cc2\" style=\"width:800px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_efee03256b484be898e9ad6456576cc2 = echarts.init(document.getElementById('efee03256b484be898e9ad6456576cc2'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_efee03256b484be898e9ad6456576cc2 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u8fd140\\u5e74\\u56db\\u5ddd\\u7701\\u53ca\\u5176\\u5468\\u56f44.5\\u7ea7\\u4ee5\\u4e0a\\u5730\\u9707\\u6b21\\u6570\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\"\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 4056885,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"symbol\": \"emptyCircle\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"showSymbol\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    1979,\n",
       "                    3.0\n",
       "                ],\n",
       "                [\n",
       "                    1980,\n",
       "                    7.0\n",
       "                ],\n",
       "                [\n",
       "                    1981,\n",
       "                    11.0\n",
       "                ],\n",
       "                [\n",
       "                    1982,\n",
       "                    9.0\n",
       "                ],\n",
       "                [\n",
       "                    1983,\n",
       "                    10.0\n",
       "                ],\n",
       "                [\n",
       "                    1984,\n",
       "                    8.0\n",
       "                ],\n",
       "                [\n",
       "                    1985,\n",
       "                    10.0\n",
       "                ],\n",
       "                [\n",
       "                    1986,\n",
       "                    16.0\n",
       "                ],\n",
       "                [\n",
       "                    1987,\n",
       "                    8.0\n",
       "                ],\n",
       "                [\n",
       "                    1988,\n",
       "                    17.0\n",
       "                ],\n",
       "                [\n",
       "                    1989,\n",
       "                    54.0\n",
       "                ],\n",
       "                [\n",
       "                    1990,\n",
       "                    15.0\n",
       "                ],\n",
       "                [\n",
       "                    1991,\n",
       "                    12.0\n",
       "                ],\n",
       "                [\n",
       "                    1992,\n",
       "                    11.0\n",
       "                ],\n",
       "                [\n",
       "                    1993,\n",
       "                    15.0\n",
       "                ],\n",
       "                [\n",
       "                    1994,\n",
       "                    7.0\n",
       "                ],\n",
       "                [\n",
       "                    1995,\n",
       "                    18.0\n",
       "                ],\n",
       "                [\n",
       "                    1996,\n",
       "                    26.0\n",
       "                ],\n",
       "                [\n",
       "                    1997,\n",
       "                    19.0\n",
       "                ],\n",
       "                [\n",
       "                    1998,\n",
       "                    10.0\n",
       "                ],\n",
       "                [\n",
       "                    1999,\n",
       "                    9.0\n",
       "                ],\n",
       "                [\n",
       "                    2000,\n",
       "                    18.0\n",
       "                ],\n",
       "                [\n",
       "                    2001,\n",
       "                    16.0\n",
       "                ],\n",
       "                [\n",
       "                    2002,\n",
       "                    11.0\n",
       "                ],\n",
       "                [\n",
       "                    2003,\n",
       "                    18.0\n",
       "                ],\n",
       "                [\n",
       "                    2004,\n",
       "                    16.0\n",
       "                ],\n",
       "                [\n",
       "                    2005,\n",
       "                    10.0\n",
       "                ],\n",
       "                [\n",
       "                    2006,\n",
       "                    13.0\n",
       "                ],\n",
       "                [\n",
       "                    2007,\n",
       "                    6.0\n",
       "                ],\n",
       "                [\n",
       "                    2008,\n",
       "                    340.0\n",
       "                ],\n",
       "                [\n",
       "                    2009,\n",
       "                    31.0\n",
       "                ],\n",
       "                [\n",
       "                    2010,\n",
       "                    27.0\n",
       "                ],\n",
       "                [\n",
       "                    2011,\n",
       "                    21.0\n",
       "                ],\n",
       "                [\n",
       "                    2012,\n",
       "                    17.0\n",
       "                ],\n",
       "                [\n",
       "                    2013,\n",
       "                    71.0\n",
       "                ],\n",
       "                [\n",
       "                    2014,\n",
       "                    43.0\n",
       "                ],\n",
       "                [\n",
       "                    2015,\n",
       "                    20.0\n",
       "                ],\n",
       "                [\n",
       "                    2016,\n",
       "                    24.0\n",
       "                ],\n",
       "                [\n",
       "                    2017,\n",
       "                    31.0\n",
       "                ],\n",
       "                [\n",
       "                    2018,\n",
       "                    24.0\n",
       "                ],\n",
       "                [\n",
       "                    2019,\n",
       "                    21.0\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"normal\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 4056885\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 15\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 16\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1979.0,\n",
       "                1980.0,\n",
       "                1981.0,\n",
       "                1982.0,\n",
       "                1983.0,\n",
       "                1984.0,\n",
       "                1985.0,\n",
       "                1986.0,\n",
       "                1987.0,\n",
       "                1988.0,\n",
       "                1989.0,\n",
       "                1990.0,\n",
       "                1991.0,\n",
       "                1992.0,\n",
       "                1993.0,\n",
       "                1994.0,\n",
       "                1995.0,\n",
       "                1996.0,\n",
       "                1997.0,\n",
       "                1998.0,\n",
       "                1999.0,\n",
       "                2000.0,\n",
       "                2001.0,\n",
       "                2002.0,\n",
       "                2003.0,\n",
       "                2004.0,\n",
       "                2005.0,\n",
       "                2006.0,\n",
       "                2007.0,\n",
       "                2008.0,\n",
       "                2009.0,\n",
       "                2010.0,\n",
       "                2011.0,\n",
       "                2012.0,\n",
       "                2013.0,\n",
       "                2014.0,\n",
       "                2015.0,\n",
       "                2016.0,\n",
       "                2017.0,\n",
       "                2018.0,\n",
       "                2019.0\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"boundaryGap\": true,\n",
       "            \"type\": \"value\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_efee03256b484be898e9ad6456576cc2.setOption(option_efee03256b484be898e9ad6456576cc2);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.line.Line at 0x7f5665c85ef0>"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Line\n",
    "\n",
    "\n",
    "line = Line(\"近40年四川省及其周围4.5级以上地震次数\", width=800, height=400)\n",
    "\n",
    "line.add('', eq_sichuan_years.index, eq_sichuan_years.values, is_smooth=True,\n",
    "             legend_text_size=15,xaxis_label_textsize=16,\n",
    "             yaxis_label_textsize=18)\n",
    "line"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "id": "2466D124C1A4465087F1FD910BAF1C9D",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30.9"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan_years.loc[2009:2018].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "id": "8D876EE2082D4C8D9013005B804967EF",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13.89655172413793"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan_years.loc[1979:2007].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "id": "A55198F7FB514CBD8A2378D4CEBE5C26",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([  3,   7,  11,   9,  10,   8,  10,  16,   8,  17,  54,  15,  12,\n",
       "        11,  15,   7,  18,  26,  19,  10,   9,  18,  16,  11,  18,  16,\n",
       "        10,  13,   6, 340,  31,  27,  21,  17,  71,  43,  20,  24,  31,\n",
       "        24,  21])"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan_years.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "id": "A1BD0996CD744855B0672C74C0FD9270",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>depth</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>id</th>\n",
       "      <th>place</th>\n",
       "      <th>type</th>\n",
       "      <th>status</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>2017-08-08 13:19:49.540</td>\n",
       "      <td>33.1926</td>\n",
       "      <td>103.8552</td>\n",
       "      <td>9.0</td>\n",
       "      <td>6.5</td>\n",
       "      <td>mww</td>\n",
       "      <td>us2000a5x1</td>\n",
       "      <td>36km WSW of Yongle, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146</th>\n",
       "      <td>2014-08-03 08:30:13.570</td>\n",
       "      <td>27.1891</td>\n",
       "      <td>103.4086</td>\n",
       "      <td>12.0</td>\n",
       "      <td>6.2</td>\n",
       "      <td>mww</td>\n",
       "      <td>usb000rzmg</td>\n",
       "      <td>11km W of Wenping, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>2013-04-20 00:02:47.540</td>\n",
       "      <td>30.3080</td>\n",
       "      <td>102.8880</td>\n",
       "      <td>14.0</td>\n",
       "      <td>6.6</td>\n",
       "      <td>mww</td>\n",
       "      <td>usb000gcdd</td>\n",
       "      <td>56km WSW of Linqiong, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>291</th>\n",
       "      <td>2010-04-13 23:49:38.330</td>\n",
       "      <td>33.1650</td>\n",
       "      <td>96.5480</td>\n",
       "      <td>17.0</td>\n",
       "      <td>6.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000hbbt</td>\n",
       "      <td>southern Qinghai, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>445</th>\n",
       "      <td>2008-05-25 08:21:49.990</td>\n",
       "      <td>32.5600</td>\n",
       "      <td>105.4230</td>\n",
       "      <td>18.0</td>\n",
       "      <td>6.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000g7r4</td>\n",
       "      <td>Sichuan-Gansu border region, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>592</th>\n",
       "      <td>2008-05-12 11:11:02.480</td>\n",
       "      <td>31.2140</td>\n",
       "      <td>103.6180</td>\n",
       "      <td>10.0</td>\n",
       "      <td>6.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000g68b</td>\n",
       "      <td>eastern Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>663</th>\n",
       "      <td>2008-05-12 06:28:01.570</td>\n",
       "      <td>31.0020</td>\n",
       "      <td>103.3220</td>\n",
       "      <td>19.0</td>\n",
       "      <td>7.9</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000g650</td>\n",
       "      <td>eastern Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>771</th>\n",
       "      <td>2000-09-12 00:27:58.620</td>\n",
       "      <td>35.3890</td>\n",
       "      <td>99.3430</td>\n",
       "      <td>10.0</td>\n",
       "      <td>6.1</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp000a03h</td>\n",
       "      <td>southern Qinghai, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>774</th>\n",
       "      <td>2000-06-07 21:46:55.900</td>\n",
       "      <td>26.8560</td>\n",
       "      <td>97.2380</td>\n",
       "      <td>33.0</td>\n",
       "      <td>6.3</td>\n",
       "      <td>mwc</td>\n",
       "      <td>usp0009u6j</td>\n",
       "      <td>Myanmar</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>841</th>\n",
       "      <td>1996-02-03 11:14:20.120</td>\n",
       "      <td>27.2910</td>\n",
       "      <td>100.2760</td>\n",
       "      <td>11.1</td>\n",
       "      <td>6.6</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp0007c7g</td>\n",
       "      <td>Sichuan-Yunnan border region, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1996</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>852</th>\n",
       "      <td>1995-10-23 22:46:50.810</td>\n",
       "      <td>26.0030</td>\n",
       "      <td>102.2270</td>\n",
       "      <td>10.0</td>\n",
       "      <td>6.2</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp00075n1</td>\n",
       "      <td>Sichuan-Yunnan border region, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>924</th>\n",
       "      <td>1989-09-22 02:25:50.880</td>\n",
       "      <td>31.5830</td>\n",
       "      <td>102.4330</td>\n",
       "      <td>14.6</td>\n",
       "      <td>6.1</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp0003zvq</td>\n",
       "      <td>western Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>952</th>\n",
       "      <td>1989-05-03 05:53:01.170</td>\n",
       "      <td>30.0910</td>\n",
       "      <td>99.4750</td>\n",
       "      <td>14.0</td>\n",
       "      <td>6.2</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp0003uu0</td>\n",
       "      <td>western Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>962</th>\n",
       "      <td>1989-04-25 02:13:20.830</td>\n",
       "      <td>30.0480</td>\n",
       "      <td>99.4190</td>\n",
       "      <td>7.7</td>\n",
       "      <td>6.1</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp0003uc7</td>\n",
       "      <td>western Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>968</th>\n",
       "      <td>1989-04-15 20:34:08.930</td>\n",
       "      <td>29.9870</td>\n",
       "      <td>99.1950</td>\n",
       "      <td>13.3</td>\n",
       "      <td>6.4</td>\n",
       "      <td>mw</td>\n",
       "      <td>usp0003u05</td>\n",
       "      <td>western Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1062</th>\n",
       "      <td>1981-01-23 21:13:51.700</td>\n",
       "      <td>30.9270</td>\n",
       "      <td>101.0980</td>\n",
       "      <td>33.0</td>\n",
       "      <td>6.8</td>\n",
       "      <td>ms</td>\n",
       "      <td>usp0001bve</td>\n",
       "      <td>western Sichuan, China</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1981</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        time  latitude  longitude  depth  mag magType  \\\n",
       "58   2017-08-08 13:19:49.540   33.1926   103.8552    9.0  6.5     mww   \n",
       "146  2014-08-03 08:30:13.570   27.1891   103.4086   12.0  6.2     mww   \n",
       "223  2013-04-20 00:02:47.540   30.3080   102.8880   14.0  6.6     mww   \n",
       "291  2010-04-13 23:49:38.330   33.1650    96.5480   17.0  6.9     mwc   \n",
       "445  2008-05-25 08:21:49.990   32.5600   105.4230   18.0  6.1     mwc   \n",
       "592  2008-05-12 11:11:02.480   31.2140   103.6180   10.0  6.1     mwc   \n",
       "663  2008-05-12 06:28:01.570   31.0020   103.3220   19.0  7.9     mwc   \n",
       "771  2000-09-12 00:27:58.620   35.3890    99.3430   10.0  6.1     mwc   \n",
       "774  2000-06-07 21:46:55.900   26.8560    97.2380   33.0  6.3     mwc   \n",
       "841  1996-02-03 11:14:20.120   27.2910   100.2760   11.1  6.6      mw   \n",
       "852  1995-10-23 22:46:50.810   26.0030   102.2270   10.0  6.2      mw   \n",
       "924  1989-09-22 02:25:50.880   31.5830   102.4330   14.6  6.1      mw   \n",
       "952  1989-05-03 05:53:01.170   30.0910    99.4750   14.0  6.2      mw   \n",
       "962  1989-04-25 02:13:20.830   30.0480    99.4190    7.7  6.1      mw   \n",
       "968  1989-04-15 20:34:08.930   29.9870    99.1950   13.3  6.4      mw   \n",
       "1062 1981-01-23 21:13:51.700   30.9270   101.0980   33.0  6.8      ms   \n",
       "\n",
       "              id                                place        type    status  \\\n",
       "58    us2000a5x1            36km WSW of Yongle, China  earthquake  reviewed   \n",
       "146   usb000rzmg             11km W of Wenping, China  earthquake  reviewed   \n",
       "223   usb000gcdd          56km WSW of Linqiong, China  earthquake  reviewed   \n",
       "291   usp000hbbt              southern Qinghai, China  earthquake  reviewed   \n",
       "445   usp000g7r4   Sichuan-Gansu border region, China  earthquake  reviewed   \n",
       "592   usp000g68b               eastern Sichuan, China  earthquake  reviewed   \n",
       "663   usp000g650               eastern Sichuan, China  earthquake  reviewed   \n",
       "771   usp000a03h              southern Qinghai, China  earthquake  reviewed   \n",
       "774   usp0009u6j                              Myanmar  earthquake  reviewed   \n",
       "841   usp0007c7g  Sichuan-Yunnan border region, China  earthquake  reviewed   \n",
       "852   usp00075n1  Sichuan-Yunnan border region, China  earthquake  reviewed   \n",
       "924   usp0003zvq               western Sichuan, China  earthquake  reviewed   \n",
       "952   usp0003uu0               western Sichuan, China  earthquake  reviewed   \n",
       "962   usp0003uc7               western Sichuan, China  earthquake  reviewed   \n",
       "968   usp0003u05               western Sichuan, China  earthquake  reviewed   \n",
       "1062  usp0001bve               western Sichuan, China  earthquake  reviewed   \n",
       "\n",
       "      year  \n",
       "58    2017  \n",
       "146   2014  \n",
       "223   2013  \n",
       "291   2010  \n",
       "445   2008  \n",
       "592   2008  \n",
       "663   2008  \n",
       "771   2000  \n",
       "774   2000  \n",
       "841   1996  \n",
       "852   1995  \n",
       "924   1989  \n",
       "952   1989  \n",
       "962   1989  \n",
       "968   1989  \n",
       "1062  1981  "
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq_sichuan[eq_sichuan['mag']>6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "id": "0A0B19B26D634BAB83BDEF41E5C6FCD1",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_sichuan['latitude'] = eq_sichuan['latitude'].astype(str)\n",
    "eq_sichuan['longitude'] = eq_sichuan['longitude'].astype(str)\n",
    "eq_sichuan['latlon'] = eq_sichuan['longitude'].str.cat(eq_sichuan['latitude'], sep=',')\n",
    "eq_sichuan[['latitude', 'longitude', 'mag', 'latlon']].to_csv('sichuan_graph.csv', index=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "F73496110CD547818BF16909811A88C1",
    "mdEditEnable": false
   },
   "source": [
    "#### 2.6 我国哪些地方比较经常发生地震？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "id": "E2451F43EE3045F785D6989A2433704D",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_china = eq20_years[(eq20_years['latitude'] < 51.9824)\n",
    "                      & (eq20_years['longitude'] < 136.1715) \n",
    "                      & (eq20_years['latitude'] > 0) \n",
    "                      & (eq20_years['longitude'] > 73.2418)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "id": "CD4F929B49B84F8F831F175DC11430E3",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "eq_china = eq_china[['latitude', 'longitude', 'mag']]\n",
    "eq_china['latitude'] = eq_china['latitude'].astype(str)\n",
    "eq_china['longitude'] = eq_china['longitude'].astype(str)\n",
    "eq_china['latlon'] = eq_china['longitude'].str.cat(eq_china['latitude'], sep=',')\n",
    "\n",
    "eq_china.to_csv('eq_china.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
